// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

@use "refactor/common-refactor.scss" as deprecated;

.workspace-context-menu {
  position: absolute;
  top: deprecated.$s-40;
  left: deprecated.$s-736;
  z-index: deprecated.$z-index-4;
}

.context-list,
.workspace-context-submenu {
  @include deprecated.menuShadow;
  display: grid;
  width: deprecated.$s-240;
  padding: deprecated.$s-4;
  border-radius: deprecated.$br-8;
  border: deprecated.$s-2 solid var(--panel-border-color);
  background-color: var(--menu-background-color);
  max-height: 100vh;
  overflow-y: auto;
}

.workspace-context-submenu {
  position: absolute;
}

.separator {
  height: deprecated.$s-12;
}

.context-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: deprecated.$s-28;
  width: 100%;
  padding: deprecated.$s-6;
  border-radius: deprecated.$br-8;
  cursor: pointer;

  .title {
    @include deprecated.bodySmallTypography;
    color: var(--menu-foreground-color);
  }
  .shortcut {
    @include deprecated.flexCenter;
    gap: deprecated.$s-2;
    color: var(--menu-shortcut-foreground-color);
    .shortcut-key {
      @include deprecated.bodySmallTypography;
      @include deprecated.flexCenter;
      height: deprecated.$s-20;
      padding: deprecated.$s-2 deprecated.$s-6;
      border-radius: deprecated.$br-6;
      background-color: var(--menu-shortcut-background-color);
    }
  }

  .submenu-icon svg {
    @extend .button-icon-small;
    stroke: var(--menu-foreground-color);
  }

  &:hover {
    background-color: var(--menu-background-color-hover);
    .title {
      color: var(--menu-foreground-color-hover);
    }
    .shortcut {
      color: var(--menu-shortcut-foreground-color-hover);
    }
  }
  &:focus {
    border: 1px solid var(--menu-border-color-focus);
    background-color: var(--menu-background-color-focus);
  }
}

.icon-menu-item {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  height: deprecated.$s-28;
  padding: deprecated.$s-6;
  border-radius: deprecated.$br-8;
  &:hover {
    background-color: var(--menu-background-color-hover);
  }

  span.title {
    margin-left: deprecated.$s-6;
  }

  .selected-icon {
    svg {
      @extend .button-icon-small;
      stroke: var(--menu-foreground-color);
    }
  }

  .shape-icon {
    margin-left: deprecated.$s-2;
    svg {
      @extend .button-icon-small;
      stroke: var(--menu-foreground-color);
    }
  }

  .icon-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 0;
  }
}

.icon-menu-item[disabled],
.context-menu-item[disabled] {
  pointer-events: none;
  opacity: 0.6;
}
